import Vue from 'vue'
import Router from 'vue-router'

import home from '@/components/home/home'
import ranking from '@/components/home/ranking/ranking'
import popular from '@/components/home/ranking/popular/popular'
import newranking from '@/components/home/ranking/newranking/newranking'

import activity from '@/components/home/activity/activity'
import active from '@/components/home/activity/active/active'
// import prize from '@/components/home/activity/prize/prize'
import activeNotice from '@/components/home/activity/active-notice/active-notice'

import open from '@/components/home/open/open'
import opening from '@/components/home/open/opening/opening'
import trailer from '@/components/home/open/trailer/trailer'

import game from '@/components/home/game/game'
import shelves from '@/components/home/game/shelves/shelves'
import gamehot from '@/components/home/game/gamehot/gamehot'
import like from '@/components/home/game/like/like'
import gamehall from '@/components/home/game/gamehall/gamehall'

import gift from '@/components/gift/gift'
import newest from '@/components/gift/newest/newest'
import hot from '@/components/gift/hot/hot'

import me from '@/components/me/me'
import about from '@/components/me/about/about'
import mygift from '@/components/me/mygift/mygift'
import bill from '@/components/me/bill/bill'
import mygame from '@/components/me/mygame/mygame'
import message from '@/components/me/message/message'
import opinion from '@/components/me/opinion/opinion'

import notice from '@/components/notice/notice'
import phoneLogin from '@/components/login/phone-login'
import phoneRegister from '@/components/register/phone-register'
import PCGame from '@/components/pc-game/pc-game'
import phoneForget from '@/components/forget/phone-forget'

Vue.use(Router)

export default new Router({
  linkActiveClass: 'active',
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    //首页
    {
      path: '/home',
      name: 'home',
      component: home,
      redirect: 'home/game/gameHot',
      children: [
        {
          path: 'game',
          name: 'game',
          component: game,
          redirect: 'gameHot',
          meta: {keepAlive: true},
          children: [
            {
              path: 'gameHot',
              name: 'gameHot',
              component: gamehot,
              meta: {keepAlive: true, parent: 'game', root: 'game'}
            },
            {
              path: 'shelves',
              name: 'shelves',
              component: shelves,
              meta: {keepAlive: true, parent: 'game', root: 'game'}
            },
            {
              path: 'like',
              name: 'like',
              component: like,
              meta: {keepAlive: true, parent: 'game', root: 'game'}
            }
          ]
        },
        {
          path: 'activity',
          name: 'activity',
          redirect: 'active',
          component: activity,
          meta: {keepAlive: true},
          children: [
            {
              path: 'active',
              name: 'active',
              component: active,
              meta: {keepAlive: true, parent: 'activity', root: 'game'}
            },
            // {
            //   path: 'prize',
            //   name: 'prize',
            //   component: prize,
            //   meta: {keepAlive: true, parent: 'activity', root: 'game'}
            // },
            {
              path: 'activeNotice',
              name: 'activeNotice',
              component: activeNotice,
              meta: {keepAlive: true, parent: 'activity', root: 'game'}
            }
          ]
        },
        {
          path: 'open',
          name: 'open',
          redirect: 'opening',
          component: open,
          meta: {keepAlive: true},
          children: [
            {
              path: 'opening',
              name: 'opening',
              component: opening,
              meta: {keepAlive: true, parent: 'open', root: 'game'}
            },
            {
              path: 'trailer',
              name: 'trailer',
              component: trailer,
              meta: {keepAlive: true, parent: 'open', root: 'game'}
            }
          ]
        },
        {
          path: 'ranking',
          name: 'ranking',
          component: ranking,
          redirect: 'popular',
          meta: {keepAlive: true},
          children: [
            {
              path: 'popular',
              name: 'popular',
              component: popular,
              meta: {keepAlive: true, parent: 'ranking', root: 'game'}
            },
            {
              path: 'newRanking',
              name: 'newRanking',
              component: newranking,
              meta: {keepAlive: true, parent: 'ranking', root: 'game'}
            }
          ]
        }
      ]
    },
    {
      path: '/gift',
      name: 'gift',
      component: gift,
      redirect: 'newest',
      meta: {keepAlive: true},
      children: [
        {
          path: 'newest',
          name: 'newest',
          component: newest,
          meta: {keepAlive: true, parent: 'newest', root: 'gift'}
        },
        {
          path: 'hot',
          name: 'hot',
          component: hot,
          meta: {keepAlive: true, parent: 'hot', root: 'gift'}
        }
      ]
    },
    {
      path: '/me',
      name: 'me',
      component: me,
      meta: {keepAlive: true, parent: 'me', root: 'me'},
      children: [
        {
          path: 'about',
          name: 'about',
          component: about,
          meta: {keepAlive: false, root: 'me'}
        },
        {
          path: 'myGift',
          name: 'myGift',
          component: mygift,
          meta: {keepAlive: false, root: 'me'}
        },
        {
          path: 'bill',
          name: 'bill',
          component: bill,
          meta: {keepAlive: false, root: 'me'}
        },
        {
          path: 'myGame',
          name: 'myGame',
          component: mygame,
          meta: {keepAlive: false, root: 'me'}
        },
        {
          path: 'message',
          name: 'message',
          component: message,
          meta: {keepAlive: false, root: 'me'}
        },
        {
          path: 'myOpinion',
          name: 'myOpinion',
          component: opinion,
          meta: {keepAlive: false, root: 'me'}
        }
      ]
    },
    {
      path: '/notice',
      name: 'notice',
      component: notice,
      meta: {keepAlive: false}
    },
    {
      path: '/home/game/gameHall',
      name: 'gamehall',
      component: gamehall,
      //这个是false
      meta: {keepAlive: false}
    },
    //手机登录
    {
      path: '/phoneLogin',
      name: 'phoneLogin',
      component: phoneLogin
    },
    //手机注册
    {
      path: '/phoneRegister',
      name: 'phoneRegister',
      component: phoneRegister
    },
    //
    {
      path: '/phoneForget',
      name: 'phoneForget',
      component: phoneForget
    },
    //pc端游戏界面
    {
      path: '/PCGame',
      name: 'PCGame',
      component: PCGame
    }
  ]
})
